<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改机构学生信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-student-edit" th:object="${student}">
        <input name="stuId" th:field="*{stuId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">家长id：</label>
            <div class="col-sm-8">
                <input name="suId" th:field="*{suId}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">学生姓名：</label>
            <div class="col-sm-8">
                <input name="stuName" th:field="*{stuName}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">学生备注：</label>
            <div class="col-sm-8">
                <input name="stuRemark" th:field="*{stuRemark}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">学生年级：</label>
            <div class="col-sm-8">
                <input name="stuGrade" th:field="*{stuGrade}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">所在学校：</label>
            <div class="col-sm-8">
                <input name="stuSchool" th:field="*{stuSchool}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">学生年纪：</label>
            <div class="col-sm-8">
                <input name="stuAge" th:field="*{stuAge}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">学生性别：</label>
            <div class="col-sm-8">
                <div class="radio-box">
                    <input type="radio" name="stuGender" value="1" th:field="*{stuGender}">
                    <label th:for="stuGender" th:text="男"></label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="stuGender" value="0" th:field="*{stuGender}">
                    <label th:for="stuGender" th:text="女"></label>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "itsystem/student";
    $("#form-student-edit").validate({
        focusCleanup: true,
        //添加学生表单校验规则
        rules: {
            suId: { //家长id
                required: true,//不能为空
                digits: true//是整数
            }
            , stuName: {//姓名
                required: true,//不能为空
                isName: true,//为2-4个汉字
                maxlength: 5//最大长度为5
            }
            , stuGrade: {//年级
                required: true,//不能为空
                digits: true,//是整数
                maxlength: 5//长度不能大于5
            }
            , stuSchool: {//学校
                required: true,//不能为空
                maxlength: 20//长度最大为5位数
            }
            , stuAge: {//年纪
                required:true,//不为空
                range:[1,60]//年纪在1-60之间
            }
        }
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-student-edit').serialize());
        }
    }
</script>
</body>
</html>